package com.lphj.datainterface.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

@Controller
public class Login {

    @RequestMapping("login")
    String login(){
        return "login";
    }

    @RequestMapping("checkLogin")
    String checkLogin(String username, String password, HttpServletRequest request) {
        if(username.equals("lphj001") && password.equals("lphj001")) {
            request.getSession().setAttribute("user",username + "-" + password);
            return "home";
        }
        return "error";
    }
}
